<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绘制圆弧</title>
    <style>
        canvas{
            border: 1px solid #333;
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="600" height="600"></canvas>
    <script>
        const canvas = document.getElementById('canvas');
        const ctx = canvas.getContext('2d');

        let x = 300; 
        let y = 300; 

        // ctx.arc(x,y,r,startAngle,endAngle,direction)
        // x:圆心坐标x y:圆心坐标y r:圆心半径 startAngle:起始弧度 endAngle:终止弧度 direction:圆弧方向

        // 弧度、角度转换  弧度单位PI 1弧度=180度    1度 = pi/180
        
        ctx.strokeStyle = 'red';    // 设置边线颜色
        ctx.fillStyle = 'blue';     // 设置填充颜色
        ctx.lineWidth = 10;         // 设置变现宽度
        ctx.arc(300,300,100,0,2*Math.PI,false); // 绘制圆弧
        ctx.stroke();   // 绘制边线
        ctx.fill();     // 填充
    </script>
</body>
</html>